#include <iostream>

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef int ElemType;
typedef struct{
    ElemType *elem;
    int TableLen;
}SSTable;

void ST_Init(SSTable &sst,int len)//申请空间，并进行随机数生成
{
    sst.TableLen=len;
    sst.elem=(ElemType *)malloc(sizeof(ElemType)*sst.TableLen);
    int i;
    srand(time(NULL));
    for(i=0;i<sst.TableLen;i++)
    {
        sst.elem[i]=rand()%100;
    }
}
void ST_Print(SSTable ST)
{
    for(int i=0;i<ST.TableLen;i++)
    {
        printf("%3d",ST.elem[i]);
    }
    printf("\n");
}

void swap(ElemType &a,ElemType &b)
{
    ElemType tmp;
    tmp=a;
    a=b;
    b=tmp;
}

int main()
{
    SSTable st;
    ST_Init(st,10);
    ElemType a[10]={3,87,2,93,78,56,61,38,12,40};
    memcpy(st.elem,a,sizeof(a));
    ST_Print(st);
    HeapSort(st.elem,9);//
    return 0;
}
